package com.project.personal_blog.garbage_classification_management_system.mapper;

import com.project.personal_blog.garbage_classification_management_system.pojo.garbageType;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface GarbageTypeMapper {
    // 查询所有garbageType
    @Select("select * from garbagetype")
    List<garbageType> selectAll();

    // 根据id查询garbageType
    @Select("select * from garbagetype where id=#{id}")
    garbageType selectById(int id);

    // 插入garbageType
    @Insert("insert into garbagetype(name,update_time) values(#{name},#{update_time})")
    boolean insert(garbageType garbageType);

    // 更新garbageType
    @Update("update garbagetype set name=#{name},update_time=#{update_time} where id=#{id}")
    boolean update(garbageType garbageType);

    // 删除garbageType
    @Delete("delete from garbagetype where id=#{id}")
    boolean deleteById(int id);

    // 分页查询
    @Select("select * from garbagetype limit #{page},#{limit}")
    boolean pageSelect(int page, int limit);

    // 根据id排序
    @Select("select * from garbagetype where id=#{id}")
    boolean sortByIdSelect(int id);
}
